<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateLandscapingsTable extends Migration
{
    /**
     * Run the migrations.
     *园林基础数据导入表
     *
     * @return void
     */
    public function up()
    {
        //园林基础数据表
        Schema::create('landscapings', function (Blueprint $table) {
            //字段定义
            $table->increments('id');
            $table->string('park_name')->index()->comment('园林名称');
            $table->string('park_number',20)->comment('园林编号');
            $table->string('park_address')->index()->comment('园林地址');
            $table->polygon('areas')->comment('园林区域')->nullable();
            // $table->string('clean_time',80)->comment('清理时间');
            // $table->integer('vegetation_id')->unsigned()->comment('植被类型ID')->nullable(true);
            // $table->string('vegetation_yh_time',20)->comment('植被养护时间');
            $table->string('yh_areas',20)->comment('养护面积')->nullable();
            $table->tinyInteger('level')->unsigned()->comment('养护等级 0一级 1二级 2三级')->nullable();
            // $table->string('vegetation_areas',20)->comment('系统推荐面积');
            // $table->text('vegetation_remark')->comment('备注')->nullable(true);
            // $table->string('task_load',20)->comment('任务量');
            // $table->char('type',2)->comment('作业区域类型 1园林作业区域 2绿化作业区域 3车辆作业区域')->nullable();
            // $table->integer('principal_id')->unsigned()->comment('负责人id')->nullable(true);
            // $table->foreign('principal_id')->references('id')->on('employees');
            // $table->string('phone',20)->comment('电话');
            $table->integer('project_id')->unsigned()->comment('项目区域id')->nullable();
            $table->foreign('project_id')->references('id')->on('project_areas')->onDelete('set null');
            $table->softDeletes();
            $table->timestamps();

            // $table->unique(['park_number','deleted_at']);
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('landscapings');
    }
}
